﻿#region Librerias

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;

#endregion


namespace ESF.General.ClickOnce
{
	public class CustomClickOnceWebProxy : IWebProxy
	{
		private WebProxy webProxy;
 

		public CustomClickOnceWebProxy (string serverName, int port)
		{
			webProxy = new WebProxy(serverName, port);
			webProxy.UseDefaultCredentials = false;
		}
 
		public ICredentials Credentials
		{
			get { return webProxy.Credentials; }
			set { } //The important part
		}
 
		
		public void SetCredentials(ICredentials credentials) { webProxy.Credentials = credentials; }


		public bool BypassProxyOnLocal { get { return webProxy.BypassProxyOnLocal; } }


		public Uri GetProxy(Uri destination) { return webProxy.GetProxy (destination); }
		

		public bool IsBypassed(Uri host) { return webProxy.IsBypassed (host); }
		

		public bool UseDefaultCredentials { get { return webProxy.UseDefaultCredentials; } }
		

		public Uri Address { get { return webProxy.Address; } }		
	}
}
